package io.renren.modules.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.app.dao.BsDepartDao;
import io.renren.modules.app.entity.BsDepartEntity;
import io.renren.modules.app.service.BsDepartService;
import org.springframework.stereotype.Service;
import java.util.Map;



@Service("bsDepartService")
public class BsDepartServiceImpl extends ServiceImpl<BsDepartDao, BsDepartEntity> implements BsDepartService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        LambdaQueryWrapper<BsDepartEntity> wrapper = new LambdaQueryWrapper<>();

        if (params.get("departName") != null && !params.get("departName").toString().equals("")){
            wrapper.like(BsDepartEntity::getDepartName,params.get("departName"));
        }
        IPage<BsDepartEntity> page = this.page(
                new Query<BsDepartEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}
